package steam;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Test {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("张三", "李四", "王五", "找老刘", "赵老八","李四", "王五"));
        list.stream().filter(e -> e.length() < 3).skip(1).limit(1).forEach(System.out::println);
        System.out.println("============");
        Stream.concat(list.stream().filter(e -> e.length() < 3).distinct().limit(2)
                , new ArrayList<>(List.of("嫖老师", "金轮", "小缘", "毛怪")).stream()
                        .filter(e -> e.length() < 3).limit(2).skip(1)
                ).skip(2).forEach(System.out::println);
        String[] arr = new ArrayList<String>(List.of("嫖老师", "金轮", "小缘", "毛怪")).stream().toArray(String[]::new);
        System.out.println(Arrays.toString(arr));
    }
}
